//
//  CircleViewController.m
//  CAShapeLayerDemo
//
//  Created by XFB on 2017/11/28.
//  Copyright © 2017年 ZhouCheng. All rights reserved.
//

#import "CircleViewController.h"
#import "DrawView.h"
#import "KeyBoardViewController.h"

@interface CircleViewController ()

@property (nonatomic, strong) DrawView *drawView;

@end

@implementation CircleViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    self.view.backgroundColor = [UIColor lightGrayColor];
    
    /// 自定义画图
    self.drawView = [[DrawView alloc] initWithFrame:CGRectMake(50, 50, 200, 200)];
    self.drawView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:self.drawView];
    
    /// 滑块
    UISlider *sliderView = [[UISlider alloc] initWithFrame:CGRectMake(20, 300, 300, 30)];
    sliderView.backgroundColor = [UIColor orangeColor];
    sliderView.minimumValue = 0;
    sliderView.maximumValue = 100;
    [sliderView addTarget:self action:@selector(sliderValueChange:) forControlEvents:UIControlEventValueChanged];
    [self.view addSubview:sliderView];
    
    /// 设置默认值
    [sliderView setValue:80 animated:YES];
    [self.drawView setPercent:80 animated:YES];
}

/// 设置滑块的值，同时修改画图
- (void)sliderValueChange:(UISlider *)sliderView
{
    [self.drawView setPercent:sliderView.value animated:YES];
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    KeyBoardViewController *vc = [[KeyBoardViewController alloc] init];
    [self presentViewController:vc animated:YES completion:nil];
}


@end
